package com.fanxing;

import java.util.ArrayList;

/**
 * @Author milian
 * @Date 2021/7/25 0025 16:18
 */
public class test {
    public static void main(String[] args) {

    }
    public static <E> E get(ArrayList<E> list, int index){
        if (list ==null||list.size()-1>index){
            throw new IllegalArgumentException("集合不能为null");
        }
        if (list.size()-1<index||index<0){
            throw new IndexOutOfBoundsException("索引不在正确范围");
        }
        return list.get(index);
    }
}

